<?php

namespace App\Http\Requests\Home;

use App\Http\Requests\Request;

class RegRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'username' => 'required|regex:/[0-9a-z]+/',
            'password' => 'required',
            'repassword' => 'required|same:password',
            'name' => 'required',
            'mobile' => 'required',
            'code' => 'required',
            'card_pwd' => 'required',
        ];
    }

    public function messages()
    {
        return [
            'username.required' => '用户名不能为空',
            'username.regex' => '用户名格式不对',
            'password.required' => '密码不能为空',
            'repassword.required' => '密码不能为空',
            'repassword.same' => '两次密码不一致',
            'name.required' => '姓名不能为空',
            'mobile.required' => '手机号不能为空',
            'code.required' => '身份证不能为空',
            'card_pwd.required' => '提现密码不能为空',
        ];
    }
}
